----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/code/logs/figure_02_phi_vs_z.log
  log type:  text
 opened on:  28 Oct 2022, 23:30:35

. *-------------------------------------------------------------------------------
. 
. 
. 
. *-----------------------------------------------------------------
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,985 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }

. 
. local LHS1 D_`var3'_phi

. local LHS2 b_D_`var3'_phi_`grvar0'

. local RHS ln_`grvar0'

. 
end of do-file

. br year isocode type D_A D_A_phi

. br year isocode type D_A D_A_phi b_D_A_phi_gdp_pw_ppp

. use "${data}/estimates_aggtype_naics_sales_s1_base_woparent.dta", clear

. tab type

        VAR |      Freq.     Percent        Cum.
------------+-----------------------------------
      manuf |         27       33.33       33.33
     others |         27       33.33       66.67
       serv |         27       33.33      100.00
------------+-----------------------------------
      Total |         81      100.00

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_A5_phi_vs_z_country.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. *-----------------------------------------------------------------
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,985 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }

. 
. local LHS1 D_`var3'_phi

. local LHS2 b_D_`var3'_phi_`grvar0'

. local RHS ln_`grvar0'

. 
. tempfile temp_agg

. save `temp_agg', replace 
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp saved

. 
end of do-file

. keep isocode D_A_phi ln_gdp_pw_ppp

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. Program: table_A5_phi_vs_z_country.do
command Program is unrecognized
r(199);

end of do-file

r(199);

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. *****************************************************************************************/
. 
. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_A5_phi_vs_z_country.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. *-----------------------------------------------------------------
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,985 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }

. 
. keep isocode D_A_phi ln_gdp_pw_ppp

. rename D_A_phi delta_phi_agg

. rename ln_gdp_pw_ppp delta_yn

. 
end of do-file

. tempfile temp_agg

. 
. save `temp_agg', replace 
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000n.tmp saved

. global typeden=1

. 
. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. . 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. 
. global lf "LF"

. 
. 
. 
. *Log

. 
. *cap log close

. 
. *log using "${clogs}/table_A5_phi_vs_z_country.log",replace

. 
. *-------------------------------------------------------------------------------

. 
. 
. 
. 
. 
. *-----------------------------------------------------------------

. 
. clear all

. 
. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. 
. 
. local grvar0 "gdp_pw_ppp" 

. 
. local grvar1 ""

. 
. local rr ""

. 
. local var3 "A"

. 
. local yy "2016"

. 
. local yy_ref=`yy'

. 
. replace year=`yy_ref'
(0 real changes made)

. 
. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. 
. drop if _merge==2
(2,985 observations deleted)

. 
. drop _merge

. 
. 
. 
. foreach var in D_A  {
  2. 
. gen `var'_phi=(-1)*`var'*(0.2)
  3. 
. *---------------------------------------
. 
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. 
. }

. 
. 
. 
. keep isocode D_A_phi ln_gdp_pw_ppp

. 
. rename D_A_phi delta_phi_agg

. 
. rename ln_gdp_pw_ppp delta_yn

. 
. format %9.2fc delta_phi_agg delta_yn

. 
. 
. 
. tempfile temp_agg

. 
. save `temp_agg', replace
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000o.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000o.tmp saved

. sort isocode

. 
. 
. 
. tempfile temp_agg

. 
. save `temp_agg', replace
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000p.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000p.tmp saved

. clear all

. 
. use "${data}/estimates_aggtype_naics_sales_s1_base_woparent.dta", clear

. 
. 
. 
. local grvar0 "LP_ppp_emp_pwt" 

. 
. local grvar1 ""

. 
. local rr ""

. 
. local var3 "A"

. 
. local yy "2016"

. 
. local yy_ref=`yy'

. 
. replace year=`yy_ref'
(0 real changes made)

. 
. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str6, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,931
        from master                         0  (_merge==1)
        from using                      2,931  (_merge==2)

    matched                                81  (_merge==3)
    -----------------------------------------

. 
. drop if _merge==2
(2,931 observations deleted)

. 
. drop _merge

. 
. 
. 
. foreach var in D_A  {
  2. 
. gen `var'_phi=(-1)*`var'*(0.2)
  3. 
. *---------------------------------------
. 
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. 
. }
(1 missing value generated)
(1 missing value generated)

. 
. 
. 
. tempfile temp

. 
. save `temp', replace
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000q.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000q.tmp saved

. clear all

. 
. use "${data}/estimates_aggtype_naics_sales_s1_base_woparent.dta", clear

. 
. 
. 
. local grvar0 "LP_ppp_emp_pwt" 

. 
. local grvar1 ""

. 
. local rr ""

. 
. local var3 "A"

. 
. local yy "2016"

. 
. local yy_ref=`yy'

. 
. replace year=`yy_ref'
(0 real changes made)

. 
. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str6, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,931
        from master                         0  (_merge==1)
        from using                      2,931  (_merge==2)

    matched                                81  (_merge==3)
    -----------------------------------------

. 
. drop if _merge==2
(2,931 observations deleted)

. 
. drop _merge

. 
. 
. 
. foreach var in D_A  {
  2. 
. gen `var'_phi=(-1)*`var'*(0.2)
  3. 
. *---------------------------------------
. 
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. 
. }
(1 missing value generated)
(1 missing value generated)

. 
. 
. 
. tempfile temp

. 
. save `temp', replace
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000r.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000r.tmp saved

. 
. 
. 
. 
. 
. *Manufacturing 

. 
. *-------------------------------------------------------------------------------------

. 
. use `temp', clear

. 
. keep if type=="manuf"
(54 observations deleted)

. 
. keep isocode D_A_phi 

. 
. rename D_A_phi delta_phi_agg

. 
. format %9.2fc delta_phi_agg 

. 
. sort isocode

. 
. 
. 
. tempfile temp_manuf

. 
. save `temp_manuf', replace 
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000s.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000s.tmp saved

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: table_A5_phi_vs_z_country.do
> Date: October 2022
> 
> Description: Reproduces Table A.5: Output per-worker and firm-embedded productivity, by country.
> 
> *****************************************************************************************/
. 
. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. *cap log close
. *log using "${clogs}/table_A5_phi_vs_z_country.log",replace
. *-------------------------------------------------------------------------------
. 
. 
. 
. 
. *Aggregate economy 
. *-----------------------------------------------------------------
. clear all

. use "${data}/estimates_agg_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "gdp_pw_ppp" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str5, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,985
        from master                         0  (_merge==1)
        from using                      2,985  (_merge==2)

    matched                                27  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,985 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }

. 
. keep isocode D_A_phi ln_gdp_pw_ppp

. rename D_A_phi delta_phi_agg

. rename ln_gdp_pw_ppp delta_yn

. format %9.2fc delta_phi_agg delta_yn

. sort isocode

. 
. tempfile temp_agg

. save `temp_agg', replace 
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000t.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000t.tmp saved

.         
.         
.         
. 
. *Manufacturing and Services 
. *-----------------------------------------------------------------
. clear all

. use "${data}/estimates_aggtype_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "LP_ppp_emp_pwt" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str6, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,931
        from master                         0  (_merge==1)
        from using                      2,931  (_merge==2)

    matched                                81  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,931 observations deleted)

. drop _merge

. 
. foreach var in D_A  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }
(1 missing value generated)
(1 missing value generated)

. 
. tempfile temp

. save `temp', replace
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000u.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000u.tmp saved

. 
. 
. *Manufacturing 
. *-------------------------------------------------------------------------------------
. use `temp', clear

. keep if type=="manuf"
(54 observations deleted)

. keep isocode D_A_phi 

. rename D_A_phi delta_phi_manuf

. format %9.2fc delta_phi_manuf 

. sort isocode

. 
. tempfile temp_manuf

. save `temp_manuf', replace 
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000v.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000v.tmp saved

. 
. 
. *Services 
. *-------------------------------------------------------------------------------------
. use `temp', clear

. keep if type=="serv"
(54 observations deleted)

. keep isocode D_A_phi 

. rename D_A_phi delta_phi_serv

. format %9.2fc delta_phi_serv 

. sort isocode

. 
. tempfile temp_serv

. save `temp_serv', replace 
(note: file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000w.tmp not found)
file C:\Users\VANESS~1\AppData\Local\Temp\ST_2d9c_00000w.tmp saved

. 
. 
. 
. 
. *Merging PHI's aggregate, manufacturing, and services 
. *-------------------------------------------------------------------------------------
. use `temp_agg', clear

. 
. merge m:1 isocode using `temp_manuf'

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                                27  (_merge==3)
    -----------------------------------------

. drop _merge

. 
. merge m:1 isocode using `temp_serv'

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                                27  (_merge==3)
    -----------------------------------------

. drop _merge

. 
. 
end of do-file

. export delimited using "F:\Dropbox (UBC-Umich)\Research_Projects\Project Javier and Natalia\TFP firm\TFP_firm_data_historical\dataverse_files\results\appendix\table_A5_phi_vs_z
> _country.csv", replace
(note: file F:\Dropbox (UBC-Umich)\Research_Projects\Project Javier and Natalia\TFP firm\TFP_firm_data_historical\dataverse_files\results\appendix\table_A5_phi_vs_z_country.csv n
> ot found)
file F:\Dropbox (UBC-Umich)\Research_Projects\Project Javier and Natalia\TFP firm\TFP_firm_data_historical\dataverse_files\results\appendix\table_A5_phi_vs_z_country.csv saved

. do "C:\Users\VANESS~1\AppData\Local\Temp\STD2d9c_000000.tmp"

. 
. *-------------------------------------------------------------------------------
. global typeden=1

. include "set_directories.do"

. /***************************************************************************************
> Firm-embedded productivity and cross-country income differences
> Alviarez, Cravino and Ramondo
> Journal of Political Economy (2022)
> 
> Program: set_directories.do
> Date: October 2022
> 
> Description: Sets directory paths
> *****************************************************************************************/
. 
. *Set root directory here
. global root "F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files" 

. 
. 
. *All other directories set automatically
. 
. *Code
. global code "${root}/code"

. global clogs "${root}/code/logs"

. global cmain "${root}/code/main"

. global cappendix "${root}/code/appendix"

. 
. *Data
. global data "${root}/data/analysis"

. global tmp  "${root}/data/tmp"

. 
. *Results
. global rmain "${root}/results/main"

. global rappendix  "${root}/results/appendix"

. 
. if $typeden==0 {
. local denominator "_exp_ko"
. }

. if $typeden==1 {
. local denominator "_ko"
. }

. *
. 
. 
. 
. /*******************************************************************************
> *Stata packages to install:
>    1) gtools
>    2) reghdfe
> *******************************************************************************/
. 
. 
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. *global maindirectory "F:/Dropbox (UBC-Umich)"
. *global maindirectory "C:\Users\cheoy\Dropbox (UBC-Umich)"
. *global tfp "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical" 
. *global tfp_bef "${maindirectory}/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data" 
. *global orbis_historical "${maindirectory}/Master_Dataset/Orbis_master/Javier_Florian/orbis_data/final_data"
. ************** ESTO DE ACA ES LO QUE TENGO QUE BORRAR **************
. 
. *global inputs "${tfp}/data/inputs"
. *global code "${tfp}/code"
. *global output "${tfp}/data/output"
. *global results "${tfp}/results"
. 
. 
. 
. 
. 
. 
. 
. 
. set memory 64g
set memory ignored.
    Memory no longer needs to be set in modern Statas; memory adjustments are performed on the fly automatically.

. global lf "LF"

. 
. *Log
. cap log close
